package data.set.adaptator;

import java.util.Iterator;

import data.set.OfflineSet;
import data.set.OfflineSetIterator;

public class ReduceOfflineSet<X> implements OfflineSet<X>{

	OfflineSet<X> fullOfflineSet;
	OfflineSet<?> referenceID;
	
	public ReduceOfflineSet(OfflineSet<X> fullOfflineSet,
			OfflineSet<?> referenceID) {
		super();
		this.fullOfflineSet = fullOfflineSet;
		this.referenceID = referenceID;
	}

	/**
	 * @return
	 * @see data.set.OfflineSet#inputsetiterator()
	 */
	public OfflineSetIterator<X> inputsetiterator() {
		return fullOfflineSet.inputsetiterator();
	}

	/**
	 * @return
	 * @see java.lang.Iterable#iterator()
	 */
	public Iterator<X> iterator() {
		return fullOfflineSet.iterator();
	}

	/**
	 * @param id
	 * @return
	 * @see data.set.OfflineSet#getObject(int)
	 */
	public X getObject(int id) {
		if(referenceID.getObject(id) != null)
			return fullOfflineSet.getObject(id);
		return null;
	}

	/**
	 * @return
	 * @see data.set.OfflineSet#size()
	 */
	public long size() {
		return referenceID.size();
	}
	
	
	
	
}
